package com.hyh.ai.services;

import org.springframework.ai.tool.annotation.Tool;
import org.springframework.ai.tool.annotation.ToolParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hyh.ai.services.FlightBookingService;

@Service
public class ToolsService {

    @Autowired
    private FlightBookingService flightBookingService;

    @Tool(description = "退票/取消预定,调用之前先查询航班信息")
    public String cancel(@ToolParam(description = "预定号,可用是纯数字") String ticketId,
                         @ToolParam(description = "姓名") String name ){
        flightBookingService.cancelBooking(ticketId,name);
        return "退票成功";
    }

    @Tool(description = "获取航班信息")
    public BookingTools.BookingDetails getBookingDetails(@ToolParam(description = "预定号,可用是纯数字") String ticketId,
                                                         @ToolParam(description = "姓名") String name ){
        return flightBookingService.getBookingDetails(ticketId,name);
    }
}
